#ifndef LOGMODEL_H
#define LOGMODEL_H

#include <QObject>
#include <QJsonArray>
#include <QJsonObject>
#include <QRegularExpression>
#include "../MainProject/sqlitedatabase.h"
#include "../MainProject/loggermanager.h"

class LogModel : public QObject {
    Q_OBJECT

public:
    explicit LogModel(QObject *parent = nullptr);

    QJsonArray queryLogTimestamps();
    QJsonArray readLogsFromFiles(const QJsonArray& timestamps, const QString& startTime, const QString& endTime, const QString& logType);
    void exportLogsToCSV(const QJsonArray& logs, const QString& filePath);

private:
    SQLiteDatabase *db;
    LoggerManager& logManager;

    QString getLogFilePath(const QString& timestamp);
    QJsonArray filterLogsByType(const QString& logContent, const QString& logType);
};

#endif // LOGMODEL_H
